﻿using CMS.BLL;
using CMS.Entities;
using CMS.Models;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;

namespace CMS.Controllers
{
    public class PartialController : Controller
    {
        //
        // GET: /Partial/

        public ActionResult GetListBlog()
        {
            List<Blog> listBlog = new List<Blog>() { new Blog { ID = "1", Name = "Chưa có chi" } };
            return PartialView("GetListBlog", listBlog);
        }

        public ActionResult ListPage(string idBlog, int selectedPage)
        {
            if (!string.IsNullOrEmpty(idBlog))
            {
                int totalPage = BizPost.TotalPostByBlog(idBlog);
                ListPageModel model = new ListPageModel { SelectedPage = selectedPage, TotalPage = totalPage, Blog = BizBlog.Get(idBlog) };
                return PartialView("ListPage", model);
            }
            else
            {
                int totalPage = BizPost.TotalPost;
                ListPageModel model = new ListPageModel { SelectedPage = selectedPage, TotalPage = totalPage, Blog = null };
                return PartialView("ListPage", model);
            }
        }

    }
}
